package com.eu.ebpm.engine.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.eu.ebpm.engine.cmd.SaveDeployInfoCommand;
import com.eu.ebpm.engine.deploy.XmlDefine;
import com.eu.ebpm.engine.entity.deploy.Deploy;
import com.eu.ebpm.engine.init.EbpmCache;
import com.eu.ebpm.engine.service.DeployService;

@Component
public class DeployServiceImpl implements DeployService {

	@Autowired
	private SaveDeployInfoCommand saveDeployInfoCommand;
	
	public void suspendProcessDefinitionByKey(String key) {
		Deploy deploy = EbpmCache.getDeployByKey(key);
		deploy.setActive(false);
	}

	public void activateProcessDefinition(String key) {
		Deploy deploy = EbpmCache.getDeployByKey(key);
		deploy.setActive(true);
	}

	public void deploy(String xmlContent) {
		saveDeployInfoCommand.execute(new XmlDefine(xmlContent));
	}

	

	
	
	
	
	
	
	
	
	
	
	
	

}
